'''
Created on Apr 6, 2013

@author: kevinbauer
'''

import numpy as np

class Test(object):

    def __init__(self, aw, test):
        self.attackWeights = aw
        self.testData = test
        
    def runTest(self):
        
        results = [] # 1 for attack, 0 if normal. The index of this array corresponds to the index of the test data.
        
        for i in np.nditer(self.testData, op_flags=['readwrite']):
            temp = []
            
            for j in np.nditer(self.attackWeights, op_flags=['readwrite']): 
                temp.append(i * j)
            
            activation = sum(temp) # Get the sum of all the products, the weights multiplied by the values per record.
            
            if  activation >= 0.5:
                results.append(1)
            else:
                results.append(0)
        
        return results